package com.qfedu.service.Impl;

import com.qfedu.dao.UserDao;
import com.qfedu.entity.User;
import com.qfedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;
    @Transactional(propagation = Propagation.SUPPORTS)
    @Override
    public void register(User user) {
        userDao.insertUser(user);
    }

    @Override
    public User selectUser(String username, String password) {
        User user = userDao.selectUser(username, password);
        return user;
    }

    @Override
    public List<User> selectAllUser() {
        List<User> list = userDao.selectAll();
        return list;
    }
}
